In [1]:
import matplotlib.pyplot as plt
from numpy import pi, sin, cos, linspace, exp, real, imag, abs, conj, angle, unwrap
from numpy.fft import fft, fftshift

import numpy as np

In [2]:
%matplotlib inline

In [41]:
b=.08*1e-3

a=.25*1e-3

k=2*pi/(795*1e-9)

wt=0

C=1

L=1.9

d=.03

ccdsize = 1300

In [4]:
def alpha(y):
    return k*a*y/(2*L)

In [5]:
def beta(y):
    return k*b*y/(2*L)

In [6]:
def E(y):
    return b*C*(sin(beta(y)) / beta(y)) * (sin(wt-k*L) + sin(wt-k*L+2*alpha(y)))

Import gaussian beam function:


In [7]:
import BeamOptics as bopt

In [105]:
d=.045

pixwidth = 1e-5  # CCD pixel width

y = linspace(-pixwidth*ccdsize/2,pixwidth*ccdsize/2,ccdsize)

In [106]:
#E_lo_gauss = bopt.gaussian_beam(0,y,10*L,E0=0.005,wavelambda=795e-9,w0=0.0030,k=[0,k*d/L,k])
E_lo_gauss = bopt.gaussian_beam(0,y,L,E0=0.005,wavelambda=795e-9,w0=0.0060,k=[0,k*d/L,k])

#TODO: change to normal LO and angled signal

In [107]:
plt.plot(y,unwrap(angle(E_lo_gauss)))
#plt.ylim([0,0.005])


Out[107]:
[<matplotlib.lines.Line2D at 0x1083214e0>]

Interesting, the phase fronts are pretty flat under these conditions. Need to revisit the Zernike model we started?


In [108]:
plt.plot(y,abs(E_lo_gauss))
plt.ylim([0,0.005])


Out[108]:
(0, 0.005)

In [109]:
TotalIntensity=(E(y)+E_lo_gauss) * (E(y)+E_lo_gauss).conj()

In [110]:
plt.figure(figsize=(14,4))
plt.plot(y,TotalIntensity,".-")

#plt.xlim([-.002,0])


/Users/dawe7269/anaconda3/lib/python3.6/site-packages/numpy/core/numeric.py:531: ComplexWarning: Casting complex values to real discards the imaginary part
  return array(a, dtype, copy=False, order=order)
Out[110]:
[<matplotlib.lines.Line2D at 0x112cd66d8>]

In [111]:
plt.plot(abs(fft(TotalIntensity)),".-")

plt.ylim([0,.0005]) # Had to lower the LO power quite a bit, and then zoom way in.

plt.xlim([300,500])


Out[111]:
(300, 500)

Summary:

With the right scaling (-0.006 to 0.006) the peaks agree fairly well. Next compare to different slit sizes.

Next:

Extend this exploration over another dimension vs. gaussian beam parameters:


In [85]:
N=15
data = np.zeros((ccdsize,N))
wmin = 0.001
wmax = 0.010

wlist = linspace(wmin,wmax,N)
for i,w in enumerate(wlist):
    E_lo_gauss = bopt.gaussian_beam(0,y,0,E0=0.005,wavelambda=795e-9,w0=w,k=[0,k*d/L,k])
    TotalIntensity=(E(y)+E_lo_gauss) * (E(y)+E_lo_gauss).conj()
    data[:,i] = abs(fft(TotalIntensity))
    #plt.plot(abs(fft(TotalIntensity)),".-")
    
#plt.xlim([150,275])
#plt.ylim([0,0.00003])

In [88]:
plt.imshow(data[375:450,:])


Out[88]:
<matplotlib.image.AxesImage at 0x11243fb38>

In [89]:
plt.plot(data[375:450,:])


Out[89]:
[<matplotlib.lines.Line2D at 0x1127d66d8>,
 <matplotlib.lines.Line2D at 0x1127d6588>,
 <matplotlib.lines.Line2D at 0x1127d6780>,
 <matplotlib.lines.Line2D at 0x1127d6240>,
 <matplotlib.lines.Line2D at 0x1127d67f0>,
 <matplotlib.lines.Line2D at 0x11251b080>,
 <matplotlib.lines.Line2D at 0x1127bf668>,
 <matplotlib.lines.Line2D at 0x1127bf0b8>,
 <matplotlib.lines.Line2D at 0x1127bfb70>,
 <matplotlib.lines.Line2D at 0x1127bfe48>,
 <matplotlib.lines.Line2D at 0x112543630>,
 <matplotlib.lines.Line2D at 0x1127bfa58>,
 <matplotlib.lines.Line2D at 0x1127bf9b0>,
 <matplotlib.lines.Line2D at 0x1127bff28>,
 <matplotlib.lines.Line2D at 0x1127bf198>]

In [100]:
Z = data[375:450,:]
xs = wlist
ys = np.linspace(150, 275, Z.shape[0])

X, Y = np.meshgrid(xs, ys)

In [101]:
from mpl_toolkits.mplot3d import axes3d

In [103]:
fig = plt.figure(figsize=(15,10))
ax = fig.add_subplot(111, projection='3d')
wframe = ax.plot_wireframe(X, Y, data[375:450,:],rstride=100)
plt.ylabel("Mode index")
plt.xlabel("w_0")


Out[103]:
Text(0.5,0,'w_0')

The spot size effectively determines the resolution. Gaussian blurring takes over for small spot sizes.


In [ ]: